import request from '@/utils/request';

/**
 * 分页查询配置信息
 * @param {*} pageParam
 */
export const page = pageParam => {
  return request({
    url: '/admin/config/page',
    data: pageParam,
    method: 'post'
  });
};

/**
 * 新增配置
 * @param {*} config
 */
export const save = config => {
  return request({
    url: '/admin/config/save',
    data: config,
    method: 'post'
  });
};

/**
 * 更新配置信息
 * @param {} config
 */
export const update = config => {
  return request({
    url: '/admin/config/update',
    data: config,
    method: 'post'
  });
};

/**
 * 获取配置详情
 * @param {*} id
 */
export const get = param => {
  return request({
    url: '/admin/config/get',
    data: param,
    method: 'post'
  });
};

/**
 * 删除配置信息
 * @param {*} id
 */
export const remove = id => {
  return request({
    url: '/admin/config/delete',
    data: {
      id: id
    },
    method: 'post'
  });
};

/**
 * 验证配置key
 * @param {*} key
 */
export const verifyConfig = param => {
  return request({
    url: '/admin/config/check',
    data: param,
    method: 'post',
    async: false
  });
};
